import { selectActivities ,getdynamiclogs } from '../services/api';

export default {
  namespace: 'workactivities',

  state: {

    data:[],

  },

  effects: {
    *wfetchList(_, { call, put }) {
      const response = yield call(selectActivities);
      yield put({
        type: 'saveList',
        payload: Array.isArray(response) ? response : [],
      });
    },


    *dynamiclogsList(_,{call,put}){

      let response = yield call (getdynamiclogs);
     // console.log('!~!~',response.data)
      yield put ({
        type:'saveList',
        payload : {data:response.data} 
      })

  
    }
  },

  reducers: {
    saveList(state, payload) {
    //  console.log('payload',payload)
      return {
        ...state,
        ...payload.payload,
      };
    },
  },
  
};
